var mongoose = require('mongoose')
var Schema = mongoose.Schema

//商品表
var goodsSchema = new Schema({
  attribute_infos: Array,
  bargain_product: Boolean,
  brand_id: Number,
  category_name: Array,
  default_image_style: String,
  description: String,
  filter_tags:  Array,
  has_video: Boolean,
  icon: String,
  id: String,
  image_list: Array,
  image_scene: String,
  image_url:String,
  is_show_product_attribute: Boolean,
  is_show_product_price: Boolean,
  is_show_product_subtitle: Boolean,
  materials: String,
  max_original_price: Number,
  max_price: Number,
  min_original_price: Number,
  min_price: Number,
  models:Array,
  name: String,
  nature: Number,
  product_type: Number,
  promotion_tag: String,
  redirect: String,
  relation_page: Object,
  review_content:String,
  review_count: Number,
  review_score: Number,
  reviewer_avatar: String,
  reviewer_name: String,
  seckill_product: Boolean,
  sell_state: Number,
  series_id: Number,
  sku_images: Array,
  sku_info: Object,
  space_id: Array,
  subtitle:String,
  tags: Array,
  videos: Array,
})
var goodsmodel = mongoose.model('goodsmodel',goodsSchema)


//用户表
var userSchema = new Schema({ 
  username:String,
  hash:String, //加密密码
  avatar:String,
  gender:String
})
var usermodel = mongoose.model('usermodel',userSchema)


//购物车
var cartSchema = new Schema({
  name: String,
  prices: Array,
  subtitle: String,
  image_url: String,
  count: Number,
  ischeck: Boolean,
  userid: String,
  goodid: String
})
var cartmodel = mongoose.model('cartmodel',cartSchema)


module.exports = {
  goodsmodel,
  usermodel,
  cartmodel
}